package Testdmo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Testdmo1.Date: 2024-02-28
 * Time：23:14
 */
public class J2_28 {
    //    定义类
    static  class WashMachine{
        public String brand; //品牌
        public String type;  //型号
        public double weight; //重量
        public double length; //长
        public  double width; //
        public double height;
        public String color;

        public void washCloth(){
            System.out.println(brand+"洗衣功能");
        }

        public void dryCloth(){
            System.out.println(brand+"脱水功能");
        }

        public void setTime(){
            System.out.println(brand+"定时功能");
        }

    }
    public static void main1(String[] args) {
        System.out.println();
        WashMachine wm1= new  WashMachine();
        wm1.brand="美的";
        wm1.type="中等";
        wm1.length=29.9;
        wm1.width=11.4;
        wm1.height=5.3;
        wm1.weight=99.8;
        wm1.color="白色";
        wm1.washCloth();
        wm1.dryCloth();
        wm1.setTime();

        WashMachine wm2=new WashMachine();
        wm1.brand="格力";
        wm1.type="大型";
        wm1.length=39.9;
        wm1.width=17.4;
        wm1.height=8.3;
        wm1.weight=199.8;
        wm2.color="黄色";
        wm1.washCloth();
        wm1.dryCloth();
        wm1.setTime();

        System.out.println(wm1.height);
        System.out.println(wm2.color);
    }



}

//类属性赋值
class Date{
    public int year;
    public int month;
    public int day;
    public void setDate(int year,int month,int day) {
        this.year=year;
        this.month=month;
        this.day=day;
    }
    public void datePrint() {
        System.out.println(this.year+" 年 "+this.month+" 月 "+this.day+" 日 ");
    }

    public static void main(String[] args) {
        Date d=new Date();
        d.year=2024;
        d.month=2;
        d.day=28;
        d.setDate(d.year, d.month, d.day);
        d.datePrint();
    }
}
